package com.kabuda.blog.controller;

import com.kabuda.blog.dao.pojo.Admin;
import com.kabuda.blog.service.IAdminService;
import com.kabuda.blog.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author kabuda
 * @create 2023-04-06 10:40
 */

@Api(tags = "管理员接口")
@RestController
@RequestMapping("/admin")
public class AdminController {
    @Autowired
    private IAdminService adminService;

    @ApiOperation("登录")
    @PostMapping("/login")
    public Result login(@ApiParam("管理员实体") @RequestBody Admin admin){
        Result result=adminService.login(admin);
        return result;
    }
    @ApiOperation("获取登录管理员信息")
    @GetMapping("/getInfo")
    public Result getInfo(String token){
        Result result=adminService.getInfo(token);
        return result;
    }
    @ApiOperation("退出登录")
    @GetMapping("/logout")
    public Result logout(String token){
        Result result=adminService.logout(token);
        return result;
    }
}
